<?php
$this->widget(
	'library\widgets\BreadCrumbs', 
	array('index', 'categories')
);
?>

<?php $this->widget('library\widgets\Tips'); ?>

<?php
$editUrl = $this->getHtml()->a('修改', $this->util->getUrlByCtrl('edit', array('id' => '__category_id__')));
$removeUrl = $this->getHtml()->button(
	'删除', 'btn___category_id__',
	array(
		'onclick' => 'return recycle(\'' . $this->util->getUrlByCtrl('remove', array('id' => '__category_id__')) . '\', this, \'确定删除？\');'
	)
);
$viewUrl = $this->getHtml()->a('查看文档', $this->util->getUrlByMod('list', 'posts', array('category_id' => '__category_id__')));
$__operate__ = $viewUrl . ' | ' . $editUrl . ' | ' . $removeUrl;
?>

<?php
echo $this->getHtml()->a('添加', $this->util->getUrlByCtrl('add'), array('class' => 'button black medium bigrounded'));
?>

<?php
$this->widget(
	'library\widgets\TableBuilder',
	array(
		'columns' => array(
			'category_name',
			'posts_count' => array(
				'name' => 'category_id',
				'label' => '文档数',
				'attributes' => array(
					'width' => '3%',
					'nowrap' => 'nowrap'
				),
				'callback' => array($this->util->getForm('Posts', 'post'), 'countByCid')
			),
			'module_id' => array(
				'attributes' => array(
					'width' => '12%',
					'nowrap' => 'nowrap'
				),
				'callback' => array($this->util->getForm('Modules', 'post'), 'getNameById')
			),
			'is_hide' => array(
				'attributes' => array(
					'width' => '3%',
					'nowrap' => 'nowrap'
				),
				'callback' => array($this->util->getForm('Categories', 'post'), 'getIsHideLabel')
			),
			'category_id' => array(
				'label' => 'ID',
				'attributes' => array(
					'width' => '1%',
					'nowrap' => 'nowrap'
				)
			),
			'__operate__' => array(
				'label' => '操作',
				'attributes' => array(
					'width' => '15%',
					'nowrap' => 'nowrap'
				),
				'value' => $__operate__,
				'replace' => 'category_id'
			)
		),
		'form' => $this->util->getForm('Categories', 'post'),
		'data' => $this->data
	)
);
?>
